import footerHtml from 'ngtemplate!html!../../../tpls/common/footer.html';

class RaceListController {
    constructor($rootScope, $scope, $cookieStore, $timeout, $state, ngDialog, dialogService, getRaceList, iRunner){

    	this.$rootScope    = $rootScope;
    	this.$cookieStore  = $cookieStore;
    	this.$timeout 	   = $timeout;
    	this.$state   	   = $state;
    	this.ngDialog 	   = ngDialog;
    	this.dialogService = dialogService;
    	this.getRaceList   = getRaceList;
    	this.iRunner 	   = iRunner;
        
    	$rootScope.footerHtml = footerHtml;

        // 获取赛事机构列表
        if(this.getRaceList.code==0){
            this.racelist = this.getRaceList.data
        }

        // 判断数据是否为空, 提示用户
        if(this.getRaceList.data.length==0){
            this.$timeout( () => {
                $('#grumble').grumble({
                    text: '这里可以创建赛事',
                    angle: 60,
                    distance: 50,
                    showAfter: 0,
                    hideAfter: false,
                    hasHideButton: true,
                    buttonHideText: 'Pop!'
                })
            }, 1000)
        }

    }
}

RaceListController.$inject = ['$rootScope', '$scope', '$cookieStore', '$timeout', '$state', 'ngDialog', 'dialogService', 'getRaceList', 'iRunner']; 

export default RaceListController;